﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Net.Sockets;

namespace VirtualPowerPointController
{
    delegate void PerformPing(String ip,int port);
    public partial class Form1 : Form
    {
        UdpClient client = new UdpClient();
        AddressSettings _add_settings = new AddressSettings();
        bool isBlankScreenShown = false;

        
        public Form1()
        {
            InitializeComponent();
            //_add_settings.performstring += Perform_Ping;
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            client.Connect(IPAddress.Loopback, 4445);
            
        }


        private void Send(string msg)
        {
            client.Send(System.Text.ASCIIEncoding.ASCII.GetBytes(msg), msg.Length);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Send("0x08");
        }

        private void button3_Click(object sender, EventArgs e)
        {
            Send("0x09");
        }

        private void button4_Click(object sender, EventArgs e)
        {
            Send("0x0b");
        }

        private void button5_Click(object sender, EventArgs e)
        {
            Send("0x0a");

        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void button8_Click(object sender, EventArgs e)
        {
            if (isBlankScreenShown) Send("0x0c");
            else Send("0x07");
            isBlankScreenShown = !isBlankScreenShown;
        }

        private void button9_Click(object sender, EventArgs e)
        {
            Send("0x05");
        }

        private void button7_Click(object sender, EventArgs e)
        {
            _add_settings.ShowDialog();
        }
        private void perform_ping(String ip, int port)
        {
           // client.setIP(ip);
          //  client.setPort(port);
          //  client.SendPing();
        }
    }
}
